{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据分析流程\n",
    "\n",
    "![](workflow.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 明确数据分析目标\n",
    "\n",
    "### 研究假设\n",
    "\n",
    "1. 公众号推文的内容会影响用户归属感\n",
    "2. 品牌的营销策略影响公众号的传播效果\n",
    "3. 公众号内容影响消费者的购买欲望"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 获取数据\n",
    "\n",
    "数据收集过程的描述。得到了XXXX条数据。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "数据表 = pd.read_excel(R'data\\副本公众号编码.xlsx')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据清理\n",
    "\n",
    "### 删除重复值\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>品牌</th>\n",
       "      <th>日期</th>\n",
       "      <th>凝聚力</th>\n",
       "      <th>忠诚度</th>\n",
       "      <th>营销策略</th>\n",
       "      <th>价格策略</th>\n",
       "      <th>购买意愿</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>小米</td>\n",
       "      <td>2019年10月29日</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>小米</td>\n",
       "      <td>2019年11月13日</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>小米</td>\n",
       "      <td>2019年11月20日</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>小米</td>\n",
       "      <td>2019年11月20日</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>娱乐性</td>\n",
       "      <td>优惠</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>小米</td>\n",
       "      <td>2020年2月21日</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>功能性</td>\n",
       "      <td>高价</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>585</th>\n",
       "      <td>苹果</td>\n",
       "      <td>2023年5月24日</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>590</th>\n",
       "      <td>苹果</td>\n",
       "      <td>2023年6月12日</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>娱乐性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>592</th>\n",
       "      <td>苹果</td>\n",
       "      <td>2023年6月15日</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>594</th>\n",
       "      <td>苹果</td>\n",
       "      <td>2023年7月3日</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>599</th>\n",
       "      <td>苹果</td>\n",
       "      <td>2023年8月18日</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>功能性</td>\n",
       "      <td>未体现</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>80 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     品牌           日期  凝聚力  忠诚度 营销策略 价格策略  购买意愿\n",
       "18   小米  2019年10月29日    5    6  功能性  未体现     3\n",
       "23   小米  2019年11月13日    5    6  功能性  未体现     6\n",
       "25   小米  2019年11月20日    3    2  功能性  未体现     1\n",
       "26   小米  2019年11月20日    2    4  娱乐性   优惠     1\n",
       "33   小米   2020年2月21日    1    1  功能性   高价     1\n",
       "..   ..          ...  ...  ...  ...  ...   ...\n",
       "585  苹果   2023年5月24日    3    3  功能性  未体现     3\n",
       "590  苹果   2023年6月12日    3    3  娱乐性  未体现     2\n",
       "592  苹果   2023年6月15日    4    3  功能性  未体现     3\n",
       "594  苹果    2023年7月3日    5    5  功能性  未体现     4\n",
       "599  苹果   2023年8月18日    5    5  功能性  未体现     4\n",
       "\n",
       "[80 rows x 7 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看重复值\n",
    "数据表[数据表.duplicated(subset=['日期','品牌'], keep='first')]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 删除重复值\n",
    "数据表.drop_duplicates(subset=['日期','品牌'], keep='first',inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "品牌      object\n",
       "日期      object\n",
       "凝聚力      int64\n",
       "忠诚度      int64\n",
       "营销策略    object\n",
       "价格策略    object\n",
       "购买意愿     int64\n",
       "dtype: object"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "数据表.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "品牌      category\n",
       "日期        object\n",
       "凝聚力        int64\n",
       "忠诚度        int64\n",
       "营销策略    category\n",
       "价格策略    category\n",
       "购买意愿       int64\n",
       "dtype: object"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "数据表.astype(\n",
    "    {\"品牌\": \"category\",\n",
    "      \"营销策略\": \"category\", \n",
    "      \"价格策略\": \"category\"\n",
    "    }\n",
    "    ).dtypes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据分析\n",
    "\n",
    "### 描述统计\n",
    "\n",
    "对样本特征、核心变量进行单变量描述统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import mytools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>品牌</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>三星</td>\n",
       "      <td>152</td>\n",
       "      <td>29.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>华为</td>\n",
       "      <td>136</td>\n",
       "      <td>26.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>苹果</td>\n",
       "      <td>129</td>\n",
       "      <td>24.67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>小米</td>\n",
       "      <td>106</td>\n",
       "      <td>20.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>总和</td>\n",
       "      <td>523</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   品牌   个数     百分比\n",
       "0  三星  152   29.06\n",
       "1  华为  136   26.00\n",
       "2  苹果  129   24.67\n",
       "3  小米  106   20.27\n",
       "4  总和  523  100.00"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(数据表,'品牌')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "domain": {
          "x": [
           0,
           1
          ],
          "y": [
           0,
           1
          ]
         },
         "hovertemplate": "品牌=%{label}<extra></extra>",
         "labels": [
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "小米",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "华为",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "三星",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果",
          "苹果"
         ],
         "legendgroup": "",
         "name": "",
         "showlegend": true,
         "type": "pie"
        }
       ],
       "layout": {
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "\n",
    "fig = px.pie(数据表,names='品牌')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>价格策略</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>未体现</td>\n",
       "      <td>335</td>\n",
       "      <td>64.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>性价比</td>\n",
       "      <td>105</td>\n",
       "      <td>20.08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>优惠</td>\n",
       "      <td>45</td>\n",
       "      <td>8.60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>高价</td>\n",
       "      <td>38</td>\n",
       "      <td>7.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>总和</td>\n",
       "      <td>523</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  价格策略   个数     百分比\n",
       "0  未体现  335   64.05\n",
       "1  性价比  105   20.08\n",
       "2   优惠   45    8.60\n",
       "3   高价   38    7.27\n",
       "4   总和  523  100.00"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(数据表,'价格策略')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "domain": {
          "x": [
           0,
           1
          ],
          "y": [
           0,
           1
          ]
         },
         "hovertemplate": "价格策略=%{label}<extra></extra>",
         "labels": [
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "性价比",
          "优惠",
          "性价比",
          "优惠",
          "高价",
          "性价比",
          "性价比",
          "优惠",
          "未体现",
          "高价",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "高价",
          "性价比",
          "性价比",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "高价",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "优惠",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "性价比",
          "性价比",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "优惠",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "优惠",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "优惠",
          "未体现",
          "高价",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "高价",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "高价",
          "性价比",
          "未体现",
          "优惠",
          "性价比",
          "未体现",
          "高价",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "高价",
          "高价",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "高价",
          "未体现",
          "性价比",
          "未体现",
          "高价",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "高价",
          "性价比",
          "未体现",
          "高价",
          "性价比",
          "高价",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "性价比",
          "优惠",
          "性价比",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "优惠",
          "性价比",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "优惠",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "未体现",
          "优惠",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "高价",
          "未体现",
          "优惠",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "高价",
          "未体现",
          "高价",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "优惠",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "性价比",
          "未体现",
          "性价比",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "优惠",
          "高价",
          "未体现",
          "未体现",
          "优惠",
          "未体现",
          "未体现",
          "未体现",
          "未体现",
          "高价",
          "未体现"
         ],
         "legendgroup": "",
         "name": "",
         "showlegend": true,
         "type": "pie"
        }
       ],
       "layout": {
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.pie(数据表,names='价格策略')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    523.000000\n",
       "mean       8.445507\n",
       "std        2.662783\n",
       "min        2.000000\n",
       "25%        6.000000\n",
       "50%        8.000000\n",
       "75%       11.000000\n",
       "max       12.000000\n",
       "Name: 用户归属感, dtype: float64"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "数据表['用户归属感'] = 数据表['凝聚力'] + 数据表['忠诚度']\n",
    "数据表['用户归属感'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.819444444444445"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "数据表.query(\"营销策略 == '娱乐性'\")['用户归属感'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8.88599348534202"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "数据表.query(\"营销策略 == '功能性'\")['用户归属感'].mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 变量相关性分析\n",
    "\n",
    "### 公众号营销策略会影响用户归属感\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "营销策略=%{x}<br>用户归属感=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa"
         },
         "name": "",
         "notched": false,
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "box",
         "x": [
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性"
         ],
         "x0": " ",
         "xaxis": "x",
         "y": [
          12,
          9,
          10,
          12,
          12,
          12,
          10,
          12,
          10,
          8,
          11,
          10,
          11,
          11,
          10,
          12,
          12,
          12,
          11,
          10,
          12,
          9,
          6,
          12,
          12,
          11,
          11,
          12,
          4,
          11,
          11,
          12,
          11,
          10,
          9,
          11,
          9,
          10,
          12,
          11,
          11,
          12,
          12,
          12,
          10,
          12,
          12,
          12,
          10,
          12,
          12,
          12,
          12,
          10,
          12,
          7,
          8,
          10,
          6,
          10,
          12,
          10,
          9,
          10,
          10,
          7,
          12,
          12,
          12,
          12,
          10,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          7,
          12,
          12,
          12,
          12,
          12,
          10,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          12,
          10,
          10,
          12,
          12,
          10,
          10,
          12,
          7,
          10,
          7,
          7,
          10,
          12,
          12,
          10,
          10,
          12,
          8,
          12,
          8,
          7,
          8,
          7,
          10,
          7,
          8,
          8,
          7,
          7,
          8,
          7,
          8,
          7,
          7,
          10,
          10,
          7,
          12,
          12,
          8,
          8,
          12,
          8,
          8,
          10,
          8,
          10,
          10,
          9,
          9,
          9,
          11,
          11,
          11,
          11,
          9,
          11,
          10,
          8,
          8,
          9,
          8,
          11,
          10,
          11,
          11,
          9,
          10,
          8,
          10,
          11,
          11,
          10,
          11,
          9,
          9,
          10,
          11,
          10,
          9,
          10,
          8,
          9,
          10,
          9,
          10,
          9,
          11,
          11,
          9,
          8,
          8,
          8,
          7,
          10,
          8,
          8,
          8,
          10,
          10,
          7,
          8,
          7,
          12,
          8,
          10,
          10,
          7,
          8,
          7,
          8,
          7,
          12,
          9,
          7,
          5,
          6,
          8,
          12,
          12,
          10,
          9,
          9,
          9,
          9,
          8,
          8,
          9,
          10,
          8,
          9,
          9,
          8,
          8,
          8,
          8,
          8,
          6,
          8,
          9,
          9,
          9,
          8,
          7,
          7,
          8,
          7,
          7,
          7,
          7,
          7,
          7,
          10,
          7,
          7,
          7,
          7,
          8,
          7,
          8,
          7,
          5,
          5,
          5,
          7,
          5,
          7,
          7,
          5,
          7,
          5,
          7,
          4,
          7,
          5,
          5,
          4,
          5,
          4,
          7,
          4,
          6,
          4,
          6,
          6,
          5,
          5,
          6,
          7,
          7,
          5,
          7,
          6,
          6,
          7,
          4,
          7,
          5,
          6,
          7,
          6,
          5,
          5,
          4,
          4,
          5,
          5,
          5,
          5,
          4,
          6,
          6,
          4,
          5,
          6,
          6,
          4,
          6,
          6,
          7,
          6,
          6,
          5,
          5,
          6,
          4,
          5,
          4,
          4,
          5,
          5,
          4,
          2,
          4,
          3,
          7,
          7,
          5,
          5,
          5,
          5,
          5,
          5,
          5,
          5,
          6,
          6,
          3,
          5,
          5,
          8,
          5,
          5,
          5,
          5,
          6,
          5,
          5,
          5,
          6,
          8,
          4,
          5,
          5,
          5,
          5,
          5,
          5,
          5,
          5,
          5,
          3,
          5,
          7,
          3,
          4,
          3,
          5,
          4,
          3,
          6,
          3,
          3,
          4,
          6,
          3,
          2,
          6,
          4,
          3,
          3,
          3,
          3,
          3,
          3,
          8,
          8,
          8,
          9,
          9,
          8,
          7,
          10,
          4,
          7,
          5,
          8,
          9,
          6,
          7,
          7,
          10,
          10,
          7,
          7,
          8,
          9,
          12,
          10,
          11,
          9,
          11,
          10,
          10,
          10,
          10,
          12,
          11,
          10,
          11,
          11,
          10,
          10,
          12,
          10,
          11,
          11,
          9,
          12,
          12,
          10,
          9,
          6,
          9,
          12,
          9,
          9,
          9,
          9,
          9,
          11,
          9,
          8,
          10,
          12,
          12,
          8,
          8,
          8,
          8,
          10,
          9,
          12,
          12,
          12,
          8,
          10,
          12,
          8,
          10,
          8,
          11,
          12,
          12,
          8,
          12,
          12,
          9,
          12,
          12,
          12,
          11,
          11,
          12,
          11,
          12,
          11,
          12,
          10,
          12,
          11,
          12,
          11,
          10,
          12,
          8,
          8,
          8,
          8,
          8,
          10,
          12,
          12,
          6,
          6,
          6,
          8,
          6,
          6,
          8,
          12,
          8,
          8,
          10,
          11,
          6,
          6,
          10,
          8,
          7,
          8,
          8,
          10,
          10
         ],
         "y0": " ",
         "yaxis": "y"
        }
       ],
       "layout": {
        "boxmode": "group",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "营销策略"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "用户归属感"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "相关比率：0.03896816022385441\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'低度相关'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "数据表['用户归属感'] = 数据表['凝聚力'] + 数据表['忠诚度']\n",
    "\n",
    "a,result = mytools.类别变量与数值变量统计分析(数据表,'营销策略','用户归属感')\n",
    "mytools.相关比率强弱判断(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table class=\"simpletable\">\n",
       "<caption>OLS Regression Results</caption>\n",
       "<tr>\n",
       "  <th>Dep. Variable:</th>          <td>用户归属感</td>      <th>  R-squared:         </th> <td>   0.039</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Model:</th>                   <td>OLS</td>       <th>  Adj. R-squared:    </th> <td>   0.037</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Method:</th>             <td>Least Squares</td>  <th>  F-statistic:       </th> <td>   21.13</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Date:</th>             <td>Thu, 14 Dec 2023</td> <th>  Prob (F-statistic):</th> <td>5.40e-06</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Time:</th>                 <td>17:23:10</td>     <th>  Log-Likelihood:    </th> <td> -1243.4</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>No. Observations:</th>      <td>   523</td>      <th>  AIC:               </th> <td>   2491.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Residuals:</th>          <td>   521</td>      <th>  BIC:               </th> <td>   2499.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Model:</th>              <td>     1</td>      <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Covariance Type:</th>      <td>nonrobust</td>    <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "       <td></td>          <th>coef</th>     <th>std err</th>      <th>t</th>      <th>P>|t|</th>  <th>[0.025</th>    <th>0.975]</th>  \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Intercept</th>   <td>    8.8860</td> <td>    0.149</td> <td>   59.587</td> <td> 0.000</td> <td>    8.593</td> <td>    9.179</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>营销策略[T.娱乐性]</th> <td>   -1.0665</td> <td>    0.232</td> <td>   -4.596</td> <td> 0.000</td> <td>   -1.522</td> <td>   -0.611</td>\n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "  <th>Omnibus:</th>       <td>92.649</td> <th>  Durbin-Watson:     </th> <td>   0.492</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Prob(Omnibus):</th> <td> 0.000</td> <th>  Jarque-Bera (JB):  </th> <td>  26.275</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Skew:</th>          <td>-0.266</td> <th>  Prob(JB):          </th> <td>1.97e-06</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Kurtosis:</th>      <td> 2.040</td> <th>  Cond. No.          </th> <td>    2.46</td>\n",
       "</tr>\n",
       "</table><br/><br/>Notes:<br/>[1] Standard Errors assume that the covariance matrix of the errors is correctly specified."
      ],
      "text/latex": [
       "\\begin{center}\n",
       "\\begin{tabular}{lclc}\n",
       "\\toprule\n",
       "\\textbf{Dep. Variable:}    &      用户归属感       & \\textbf{  R-squared:         } &     0.039   \\\\\n",
       "\\textbf{Model:}            &       OLS        & \\textbf{  Adj. R-squared:    } &     0.037   \\\\\n",
       "\\textbf{Method:}           &  Least Squares   & \\textbf{  F-statistic:       } &     21.13   \\\\\n",
       "\\textbf{Date:}             & Thu, 14 Dec 2023 & \\textbf{  Prob (F-statistic):} &  5.40e-06   \\\\\n",
       "\\textbf{Time:}             &     17:23:10     & \\textbf{  Log-Likelihood:    } &   -1243.4   \\\\\n",
       "\\textbf{No. Observations:} &         523      & \\textbf{  AIC:               } &     2491.   \\\\\n",
       "\\textbf{Df Residuals:}     &         521      & \\textbf{  BIC:               } &     2499.   \\\\\n",
       "\\textbf{Df Model:}         &           1      & \\textbf{                     } &             \\\\\n",
       "\\textbf{Covariance Type:}  &    nonrobust     & \\textbf{                     } &             \\\\\n",
       "\\bottomrule\n",
       "\\end{tabular}\n",
       "\\begin{tabular}{lcccccc}\n",
       "                     & \\textbf{coef} & \\textbf{std err} & \\textbf{t} & \\textbf{P$> |$t$|$} & \\textbf{[0.025} & \\textbf{0.975]}  \\\\\n",
       "\\midrule\n",
       "\\textbf{Intercept}   &       8.8860  &        0.149     &    59.587  &         0.000        &        8.593    &        9.179     \\\\\n",
       "\\textbf{营销策略[T.娱乐性]} &      -1.0665  &        0.232     &    -4.596  &         0.000        &       -1.522    &       -0.611     \\\\\n",
       "\\bottomrule\n",
       "\\end{tabular}\n",
       "\\begin{tabular}{lclc}\n",
       "\\textbf{Omnibus:}       & 92.649 & \\textbf{  Durbin-Watson:     } &    0.492  \\\\\n",
       "\\textbf{Prob(Omnibus):} &  0.000 & \\textbf{  Jarque-Bera (JB):  } &   26.275  \\\\\n",
       "\\textbf{Skew:}          & -0.266 & \\textbf{  Prob(JB):          } & 1.97e-06  \\\\\n",
       "\\textbf{Kurtosis:}      &  2.040 & \\textbf{  Cond. No.          } &     2.46  \\\\\n",
       "\\bottomrule\n",
       "\\end{tabular}\n",
       "%\\caption{OLS Regression Results}\n",
       "\\end{center}\n",
       "\n",
       "Notes: \\newline\n",
       " [1] Standard Errors assume that the covariance matrix of the errors is correctly specified."
      ],
      "text/plain": [
       "<class 'statsmodels.iolib.summary.Summary'>\n",
       "\"\"\"\n",
       "                            OLS Regression Results                            \n",
       "==============================================================================\n",
       "Dep. Variable:                  用户归属感   R-squared:                       0.039\n",
       "Model:                            OLS   Adj. R-squared:                  0.037\n",
       "Method:                 Least Squares   F-statistic:                     21.13\n",
       "Date:                Thu, 14 Dec 2023   Prob (F-statistic):           5.40e-06\n",
       "Time:                        17:23:10   Log-Likelihood:                -1243.4\n",
       "No. Observations:                 523   AIC:                             2491.\n",
       "Df Residuals:                     521   BIC:                             2499.\n",
       "Df Model:                           1                                         \n",
       "Covariance Type:            nonrobust                                         \n",
       "===============================================================================\n",
       "                  coef    std err          t      P>|t|      [0.025      0.975]\n",
       "-------------------------------------------------------------------------------\n",
       "Intercept       8.8860      0.149     59.587      0.000       8.593       9.179\n",
       "营销策略[T.娱乐性]    -1.0665      0.232     -4.596      0.000      -1.522      -0.611\n",
       "==============================================================================\n",
       "Omnibus:                       92.649   Durbin-Watson:                   0.492\n",
       "Prob(Omnibus):                  0.000   Jarque-Bera (JB):               26.275\n",
       "Skew:                          -0.266   Prob(JB):                     1.97e-06\n",
       "Kurtosis:                       2.040   Cond. No.                         2.46\n",
       "==============================================================================\n",
       "\n",
       "Notes:\n",
       "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n",
       "\"\"\""
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "结果解读：\n",
    "\n",
    "根据统计分析结果，p eta平方，不同的营销策略的用户归属感存在显著性差异，谁高谁低"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2. 品牌的营销策略影响公众号的传播效果\n",
    "3. \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.1 公众号营销策略影响消费者的购买欲望\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "营销策略=%{x}<br>购买意愿=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa"
         },
         "name": "",
         "notched": false,
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "box",
         "x": [
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "功能性",
          "娱乐性",
          "功能性",
          "娱乐性",
          "娱乐性",
          "功能性",
          "功能性",
          "功能性",
          "功能性"
         ],
         "x0": " ",
         "xaxis": "x",
         "y": [
          1,
          5,
          5,
          1,
          2,
          1,
          4,
          6,
          6,
          4,
          1,
          6,
          1,
          1,
          1,
          6,
          6,
          2,
          4,
          5,
          6,
          6,
          1,
          6,
          6,
          6,
          2,
          4,
          1,
          3,
          5,
          6,
          3,
          1,
          1,
          3,
          4,
          5,
          6,
          6,
          1,
          6,
          6,
          1,
          1,
          1,
          6,
          6,
          3,
          4,
          6,
          4,
          1,
          1,
          1,
          1,
          1,
          5,
          1,
          2,
          1,
          1,
          1,
          5,
          1,
          3,
          6,
          6,
          6,
          6,
          6,
          4,
          1,
          1,
          6,
          2,
          5,
          6,
          1,
          1,
          1,
          6,
          1,
          5,
          4,
          5,
          5,
          6,
          6,
          6,
          6,
          5,
          6,
          6,
          6,
          5,
          6,
          6,
          5,
          1,
          5,
          6,
          6,
          3,
          4,
          6,
          4,
          5,
          2,
          1,
          6,
          6,
          6,
          3,
          5,
          6,
          4,
          6,
          4,
          2,
          4,
          1,
          5,
          1,
          1,
          4,
          4,
          4,
          4,
          4,
          4,
          1,
          4,
          5,
          2,
          4,
          6,
          6,
          5,
          5,
          6,
          5,
          4,
          5,
          5,
          5,
          5,
          5,
          5,
          4,
          6,
          4,
          4,
          4,
          4,
          3,
          4,
          4,
          1,
          3,
          4,
          6,
          5,
          6,
          5,
          4,
          4,
          4,
          5,
          4,
          6,
          1,
          5,
          4,
          5,
          3,
          1,
          2,
          4,
          5,
          4,
          3,
          5,
          5,
          5,
          2,
          4,
          5,
          4,
          1,
          1,
          1,
          4,
          5,
          2,
          4,
          1,
          2,
          1,
          2,
          4,
          2,
          2,
          2,
          5,
          6,
          4,
          4,
          4,
          4,
          1,
          6,
          5,
          1,
          2,
          1,
          4,
          5,
          6,
          2,
          4,
          4,
          1,
          4,
          1,
          1,
          5,
          5,
          4,
          5,
          4,
          4,
          4,
          4,
          1,
          3,
          3,
          4,
          4,
          4,
          2,
          4,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          2,
          2,
          2,
          2,
          2,
          1,
          2,
          2,
          2,
          2,
          2,
          2,
          1,
          2,
          2,
          2,
          2,
          2,
          2,
          4,
          2,
          3,
          2,
          3,
          2,
          2,
          2,
          3,
          3,
          2,
          4,
          3,
          2,
          2,
          2,
          2,
          6,
          3,
          5,
          5,
          4,
          4,
          4,
          2,
          3,
          1,
          3,
          2,
          3,
          2,
          4,
          3,
          2,
          3,
          4,
          2,
          1,
          4,
          4,
          4,
          5,
          4,
          6,
          5,
          5,
          4,
          3,
          1,
          4,
          3,
          3,
          4,
          2,
          1,
          1,
          5,
          3,
          4,
          4,
          3,
          3,
          3,
          3,
          3,
          3,
          3,
          3,
          2,
          2,
          2,
          4,
          1,
          2,
          1,
          2,
          2,
          2,
          1,
          1,
          2,
          4,
          3,
          4,
          5,
          4,
          2,
          4,
          3,
          3,
          3,
          2,
          2,
          2,
          4,
          2,
          1,
          2,
          3,
          2,
          1,
          3,
          2,
          2,
          3,
          3,
          2,
          2,
          3,
          2,
          1,
          1,
          1,
          2,
          1,
          1,
          2,
          1,
          3,
          4,
          3,
          3,
          2,
          1,
          1,
          4,
          1,
          1,
          5,
          1,
          2,
          1,
          4,
          5,
          1,
          2,
          3,
          3,
          5,
          4,
          6,
          4,
          4,
          5,
          4,
          4,
          4,
          6,
          6,
          5,
          5,
          4,
          5,
          5,
          6,
          5,
          5,
          5,
          3,
          6,
          5,
          5,
          5,
          2,
          2,
          6,
          4,
          4,
          3,
          4,
          3,
          4,
          4,
          3,
          5,
          6,
          6,
          4,
          3,
          1,
          2,
          1,
          1,
          6,
          6,
          6,
          4,
          6,
          6,
          2,
          5,
          1,
          6,
          6,
          6,
          5,
          6,
          6,
          3,
          6,
          6,
          6,
          1,
          4,
          6,
          6,
          5,
          4,
          6,
          4,
          5,
          4,
          6,
          4,
          4,
          6,
          3,
          4,
          4,
          4,
          4,
          5,
          6,
          6,
          1,
          3,
          3,
          4,
          3,
          3,
          4,
          6,
          4,
          4,
          5,
          6,
          3,
          3,
          5,
          3,
          3,
          3,
          3,
          5,
          5
         ],
         "y0": " ",
         "yaxis": "y"
        }
       ],
       "layout": {
        "boxmode": "group",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "营销策略"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "购买意愿"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "相关比率：0.052491134375496795\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'低度相关'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eat平方,result = mytools.类别变量与数值变量统计分析(数据表,'营销策略','购买意愿')\n",
    "mytools.相关比率强弱判断(eat平方)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table class=\"simpletable\">\n",
       "<caption>OLS Regression Results</caption>\n",
       "<tr>\n",
       "  <th>Dep. Variable:</th>          <td>购买意愿</td>       <th>  R-squared:         </th> <td>   0.052</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Model:</th>                   <td>OLS</td>       <th>  Adj. R-squared:    </th> <td>   0.051</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Method:</th>             <td>Least Squares</td>  <th>  F-statistic:       </th> <td>   28.86</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Date:</th>             <td>Thu, 14 Dec 2023</td> <th>  Prob (F-statistic):</th> <td>1.17e-07</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Time:</th>                 <td>17:40:08</td>     <th>  Log-Likelihood:    </th> <td> -1013.7</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>No. Observations:</th>      <td>   523</td>      <th>  AIC:               </th> <td>   2031.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Residuals:</th>          <td>   521</td>      <th>  BIC:               </th> <td>   2040.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Model:</th>              <td>     1</td>      <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Covariance Type:</th>      <td>nonrobust</td>    <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "       <td></td>          <th>coef</th>     <th>std err</th>      <th>t</th>      <th>P>|t|</th>  <th>[0.025</th>    <th>0.975]</th>  \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Intercept</th>   <td>    3.7850</td> <td>    0.096</td> <td>   39.378</td> <td> 0.000</td> <td>    3.596</td> <td>    3.974</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>营销策略[T.娱乐性]</th> <td>   -0.8035</td> <td>    0.150</td> <td>   -5.372</td> <td> 0.000</td> <td>   -1.097</td> <td>   -0.510</td>\n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "  <th>Omnibus:</th>       <td>226.895</td> <th>  Durbin-Watson:     </th> <td>   1.198</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Prob(Omnibus):</th> <td> 0.000</td>  <th>  Jarque-Bera (JB):  </th> <td>  29.114</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Skew:</th>          <td>-0.094</td>  <th>  Prob(JB):          </th> <td>4.76e-07</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Kurtosis:</th>      <td> 1.860</td>  <th>  Cond. No.          </th> <td>    2.46</td>\n",
       "</tr>\n",
       "</table><br/><br/>Notes:<br/>[1] Standard Errors assume that the covariance matrix of the errors is correctly specified."
      ],
      "text/latex": [
       "\\begin{center}\n",
       "\\begin{tabular}{lclc}\n",
       "\\toprule\n",
       "\\textbf{Dep. Variable:}    &       购买意愿       & \\textbf{  R-squared:         } &     0.052   \\\\\n",
       "\\textbf{Model:}            &       OLS        & \\textbf{  Adj. R-squared:    } &     0.051   \\\\\n",
       "\\textbf{Method:}           &  Least Squares   & \\textbf{  F-statistic:       } &     28.86   \\\\\n",
       "\\textbf{Date:}             & Thu, 14 Dec 2023 & \\textbf{  Prob (F-statistic):} &  1.17e-07   \\\\\n",
       "\\textbf{Time:}             &     17:40:08     & \\textbf{  Log-Likelihood:    } &   -1013.7   \\\\\n",
       "\\textbf{No. Observations:} &         523      & \\textbf{  AIC:               } &     2031.   \\\\\n",
       "\\textbf{Df Residuals:}     &         521      & \\textbf{  BIC:               } &     2040.   \\\\\n",
       "\\textbf{Df Model:}         &           1      & \\textbf{                     } &             \\\\\n",
       "\\textbf{Covariance Type:}  &    nonrobust     & \\textbf{                     } &             \\\\\n",
       "\\bottomrule\n",
       "\\end{tabular}\n",
       "\\begin{tabular}{lcccccc}\n",
       "                     & \\textbf{coef} & \\textbf{std err} & \\textbf{t} & \\textbf{P$> |$t$|$} & \\textbf{[0.025} & \\textbf{0.975]}  \\\\\n",
       "\\midrule\n",
       "\\textbf{Intercept}   &       3.7850  &        0.096     &    39.378  &         0.000        &        3.596    &        3.974     \\\\\n",
       "\\textbf{营销策略[T.娱乐性]} &      -0.8035  &        0.150     &    -5.372  &         0.000        &       -1.097    &       -0.510     \\\\\n",
       "\\bottomrule\n",
       "\\end{tabular}\n",
       "\\begin{tabular}{lclc}\n",
       "\\textbf{Omnibus:}       & 226.895 & \\textbf{  Durbin-Watson:     } &    1.198  \\\\\n",
       "\\textbf{Prob(Omnibus):} &   0.000 & \\textbf{  Jarque-Bera (JB):  } &   29.114  \\\\\n",
       "\\textbf{Skew:}          &  -0.094 & \\textbf{  Prob(JB):          } & 4.76e-07  \\\\\n",
       "\\textbf{Kurtosis:}      &   1.860 & \\textbf{  Cond. No.          } &     2.46  \\\\\n",
       "\\bottomrule\n",
       "\\end{tabular}\n",
       "%\\caption{OLS Regression Results}\n",
       "\\end{center}\n",
       "\n",
       "Notes: \\newline\n",
       " [1] Standard Errors assume that the covariance matrix of the errors is correctly specified."
      ],
      "text/plain": [
       "<class 'statsmodels.iolib.summary.Summary'>\n",
       "\"\"\"\n",
       "                            OLS Regression Results                            \n",
       "==============================================================================\n",
       "Dep. Variable:                   购买意愿   R-squared:                       0.052\n",
       "Model:                            OLS   Adj. R-squared:                  0.051\n",
       "Method:                 Least Squares   F-statistic:                     28.86\n",
       "Date:                Thu, 14 Dec 2023   Prob (F-statistic):           1.17e-07\n",
       "Time:                        17:40:08   Log-Likelihood:                -1013.7\n",
       "No. Observations:                 523   AIC:                             2031.\n",
       "Df Residuals:                     521   BIC:                             2040.\n",
       "Df Model:                           1                                         \n",
       "Covariance Type:            nonrobust                                         \n",
       "===============================================================================\n",
       "                  coef    std err          t      P>|t|      [0.025      0.975]\n",
       "-------------------------------------------------------------------------------\n",
       "Intercept       3.7850      0.096     39.378      0.000       3.596       3.974\n",
       "营销策略[T.娱乐性]    -0.8035      0.150     -5.372      0.000      -1.097      -0.510\n",
       "==============================================================================\n",
       "Omnibus:                      226.895   Durbin-Watson:                   1.198\n",
       "Prob(Omnibus):                  0.000   Jarque-Bera (JB):               29.114\n",
       "Skew:                          -0.094   Prob(JB):                     4.76e-07\n",
       "Kurtosis:                       1.860   Cond. No.                         2.46\n",
       "==============================================================================\n",
       "\n",
       "Notes:\n",
       "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n",
       "\"\"\""
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "结论：\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
